﻿#ifndef DATAANALYSISWINDOW_H
#define DATAANALYSISWINDOW_H

#include <QWidget>
#include <QChartView>
#include <QShowEvent>
#include <QObject>
#include <qvalueaxis.h>
#include <qsplineseries.h>
#include <qlineseries.h>
#include <qtimer.h>
#include <QRandomGenerator>
#include <QTime>
#include <QBarSet>
#include <QBarSeries>
#include <QBarCategoryAxis>
#include <dbHelper.h>
#include <QTimer>
#include <QDebug>
#include <QtMath>
#include <QtCharts>
#include <QLineSeries>
#include <analyse.h>
#include <QLibrary>
#include <QBarSet>
#include <QBarSeries>
#include <QBarCategoryAxis>
#include <dbHelper.h>
#include <QMouseEvent>
#include <QDomDocument>
#include <QStringList>
#include <QDialog>
#include <QSpacerItem>
#include <QTime>
#include <QVBoxLayout>
#include <QGridLayout>

#include "mainwindow.h"
#include "llCombobox2.h"
#include "qpcrModel.h"
#include "pcrChartManager.h"
#include "pcrTable.h"
#include "pcrState.h"
#include "pcrActionBar.h"
#include "dialogAnalysisSettings.h"
#include "dialogFilter.h"
#include "dialogFilter2.h"

#include "guideTable.h"
#include "dialogFileManager.h"
#include "smbManager.h"
#include "exportWlk.h"

#include "DataAnalysis.h"
#include "printerManager.h"
#include "debugLog.h"
#include "dialogAdvanceConfig.h"

#include "colordesigner.h"
#include "ui_colordesigner.h"

using namespace QtCharts;

namespace Ui {
class DataAnalysisWindow;
}

class DataAnalysisWindow : public QWidget
{
    Q_OBJECT
public:
    explicit DataAnalysisWindow(QWidget *parent = nullptr);
    ~DataAnalysisWindow();



signals:
    void changeMainWindow();
    void changeExperiInfoWindow();
    void changeSampleWindow();
    void pointLabelsVisibilityChanged(bool visible);

    void sigModelChanged();


    DialogFilter* getDialogFilter();
public slots:
    void on_openfile(QString filename = "");


private slots:

    void RefChartColor();
    void NoRefChartColor();

    // 界面点击事件
    void on_pushButton_9_clicked();     // 界面切换1
    void on_pushButton_10_clicked();    // 界面切换2
    void on_pushButton_back_clicked();  // 返回
    void on_pushButton_2_clicked();     // 分析配置

    // 其它自定义事件的响应函数
    void on_pageChanged();
    void on_reanalysis();
    void on_reanalysis_single(QStringList, QMap<QString, double>);
    void on_configSelectChanged(QStringList);
    void on_filterStart();
    void on_thrChanged();


    void on_pushButton_advanceConfig_clicked();
    void on_pushButton_3_clicked();         // 导出报告
    void on_pushButton_exportImage_clicked();
    void on_pushButton_print_clicked();
    void on_pushButton_printAll_clicked();


    void on_pushButton_5_clicked();

    void on_pushButton_6_clicked();

private:

    void resizeEvent(QResizeEvent *event) override;
    void showEvent(QShowEvent *event) override;

    void reloadData();

    void initData();

    void releaseResource();

    void updateACDialog();      // 临时，用于更新高级配置的筛选


    QString datao();
    QString datao2(QString outdir);
    QString datao(QString outdir, int type = 0);    // type0:文件夹 type1:文件名

private:
    Ui::DataAnalysisWindow*     ui;

    QMessageBox*                _boxAnalysis = nullptr;
    ColorDesigner*              color=nullptr;
    // 组件
    PCRState*                   pState;
    PCRChartManager*            _chartManager;
    PCRTable*                   _table;
    PCRActionBar*               _actionBar;
    GuideTable*                 _tableGuide;

    DialogAnalysisSettings*     _dialog_as;
    DialogFilter2*              _dialog_filter;
    DialogAdvanceConfig*        _dialog_ac;



};
#endif // DATAANALYSISWINDOW_H
